<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Unsafe #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE NoImplicitPrelude
           , MagicHash
           , UnboxedTuples
  #-}</span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# OPTIONS_HADDOCK not-home #-}</span><span>
</span><span id="line-7"></span><span>
</span><span id="line-8"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Module      :  GHC.Stable</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow, 1992-2004</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Maintainer  :  ffi@haskell.org</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Portability :  non-portable (GHC Extensions)</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Stable pointers.</span><span>
</span><span id="line-19"></span><span class="hs-comment">--</span><span>
</span><span id="line-20"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Stable</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier">StablePtr</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.Stable.html#newStablePtr"><span class="hs-identifier">newStablePtr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>        </span><span class="annot"><a href="GHC.Stable.html#deRefStablePtr"><span class="hs-identifier">deRefStablePtr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.Stable.html#freeStablePtr"><span class="hs-identifier">freeStablePtr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>        </span><span class="annot"><a href="GHC.Stable.html#castStablePtrToPtr"><span class="hs-identifier">castStablePtrToPtr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>        </span><span class="annot"><a href="GHC.Stable.html#castPtrToStablePtr"><span class="hs-identifier">castPtrToStablePtr</span></a></span><span>
</span><span id="line-29"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Ptr.html"><span class="hs-identifier">GHC.Ptr</span></a></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Base.html"><span class="hs-identifier">GHC.Base</span></a></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Unsafe.Coerce.html"><span class="hs-identifier">Unsafe.Coerce</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Unsafe.Coerce.html#unsafeCoerceAddr"><span class="hs-identifier">unsafeCoerceAddr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-37"></span><span class="hs-comment">-- Stable Pointers</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span class="hs-comment">{- |
A /stable pointer/ is a reference to a Haskell expression that is
guaranteed not to be affected by garbage collection, i.e., it will neither be
deallocated nor will the value of the stable pointer itself change during
garbage collection (ordinary references may be relocated during garbage
collection).  Consequently, stable pointers can be passed to foreign code,
which can treat it as an opaque reference to a Haskell value.

A value of type @StablePtr a@ is a stable pointer to a Haskell
expression of type @a@.
-}</span><span>
</span><span id="line-50"></span><span class="hs-keyword">data</span><span> </span><span class="hs-pragma">{-# CTYPE</span><span> </span><span class="hs-pragma">&quot;HsStablePtr&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span id="StablePtr"><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-var">StablePtr</span></a></span></span><span> </span><span id="local-6989586621679508586"><span class="annot"><a href="#local-6989586621679508586"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="StablePtr"><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-var">StablePtr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#StablePtr%23"><span class="hs-identifier hs-type">StablePtr#</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679508586"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-53"></span><span class="hs-comment">-- Create a stable pointer referring to the given Haskell value.</span><span>
</span><span id="line-54"></span><span class="hs-comment">--</span><span>
</span><span id="line-55"></span><span id="local-6989586621679508593"><span class="annot"><a href="GHC.Stable.html#newStablePtr"><span class="hs-identifier hs-type">newStablePtr</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679508593"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-type">StablePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679508593"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-56"></span><span id="newStablePtr"><span class="annot"><span class="annottext">newStablePtr :: forall a. a -&gt; IO (StablePtr a)
</span><a href="GHC.Stable.html#newStablePtr"><span class="hs-identifier hs-var hs-var">newStablePtr</span></a></span></span><span> </span><span id="local-6989586621679508566"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679508566"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(State# RealWorld -&gt; (# State# RealWorld, StablePtr a #))
-&gt; IO (StablePtr a)
forall a. (State# RealWorld -&gt; (# State# RealWorld, a #)) -&gt; IO a
</span><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-var">IO</span></a></span><span> </span><span class="annot"><span class="annottext">((State# RealWorld -&gt; (# State# RealWorld, StablePtr a #))
 -&gt; IO (StablePtr a))
-&gt; (State# RealWorld -&gt; (# State# RealWorld, StablePtr a #))
-&gt; IO (StablePtr a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679508565"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679508565"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-57"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; State# RealWorld -&gt; (# State# RealWorld, StablePtr# a #)
forall a.
a -&gt; State# RealWorld -&gt; (# State# RealWorld, StablePtr# a #)
</span><a href="../../ghc-prim/src/GHC.Prim.html#makeStablePtr%23"><span class="hs-identifier hs-var">makeStablePtr#</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679508566"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679508565"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679508564"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679508564"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679508563"><span class="annot"><span class="annottext">StablePtr# a
</span><a href="#local-6989586621679508563"><span class="hs-identifier hs-var">sp</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679508564"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">StablePtr# a -&gt; StablePtr a
forall a. StablePtr# a -&gt; StablePtr a
</span><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-var">StablePtr</span></a></span><span> </span><span class="annot"><span class="annottext">StablePtr# a
</span><a href="#local-6989586621679508563"><span class="hs-identifier hs-var">sp</span></a></span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-60"></span><span class="hs-comment">-- Obtain the Haskell value referenced by a stable pointer, i.e., the</span><span>
</span><span id="line-61"></span><span class="hs-comment">-- same value that was passed to the corresponding call to</span><span>
</span><span id="line-62"></span><span class="hs-comment">-- 'newStablePtr'.  If the argument to 'deRefStablePtr' has</span><span>
</span><span id="line-63"></span><span class="hs-comment">-- already been freed using 'freeStablePtr', the behaviour of</span><span>
</span><span id="line-64"></span><span class="hs-comment">-- 'deRefStablePtr' is undefined.</span><span>
</span><span id="line-65"></span><span class="hs-comment">--</span><span>
</span><span id="line-66"></span><span id="local-6989586621679508585"><span class="annot"><a href="GHC.Stable.html#deRefStablePtr"><span class="hs-identifier hs-type">deRefStablePtr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-type">StablePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679508585"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679508585"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-67"></span><span id="deRefStablePtr"><span class="annot"><span class="annottext">deRefStablePtr :: forall a. StablePtr a -&gt; IO a
</span><a href="GHC.Stable.html#deRefStablePtr"><span class="hs-identifier hs-var hs-var">deRefStablePtr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-type">StablePtr</span></a></span><span> </span><span id="local-6989586621679508562"><span class="annot"><span class="annottext">StablePtr# a
</span><a href="#local-6989586621679508562"><span class="hs-identifier hs-var">sp</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(State# RealWorld -&gt; (# State# RealWorld, a #)) -&gt; IO a
forall a. (State# RealWorld -&gt; (# State# RealWorld, a #)) -&gt; IO a
</span><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-var">IO</span></a></span><span> </span><span class="annot"><span class="annottext">((State# RealWorld -&gt; (# State# RealWorld, a #)) -&gt; IO a)
-&gt; (State# RealWorld -&gt; (# State# RealWorld, a #)) -&gt; IO a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679508561"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679508561"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">StablePtr# a -&gt; State# RealWorld -&gt; (# State# RealWorld, a #)
forall a.
StablePtr# a -&gt; State# RealWorld -&gt; (# State# RealWorld, a #)
</span><a href="../../ghc-prim/src/GHC.Prim.html#deRefStablePtr%23"><span class="hs-identifier hs-var">deRefStablePtr#</span></a></span><span> </span><span class="annot"><span class="annottext">StablePtr# a
</span><a href="#local-6989586621679508562"><span class="hs-identifier hs-var">sp</span></a></span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679508561"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-70"></span><span class="hs-comment">-- Dissolve the association between the stable pointer and the Haskell</span><span>
</span><span id="line-71"></span><span class="hs-comment">-- value. Afterwards, if the stable pointer is passed to</span><span>
</span><span id="line-72"></span><span class="hs-comment">-- 'deRefStablePtr' or 'freeStablePtr', the behaviour is</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- undefined.  However, the stable pointer may still be passed to</span><span>
</span><span id="line-74"></span><span class="hs-comment">-- 'castStablePtrToPtr', but the @'Foreign.Ptr.Ptr' ()@ value returned</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- by 'castStablePtrToPtr', in this case, is undefined (in particular,</span><span>
</span><span id="line-76"></span><span class="hs-comment">-- it may be 'Foreign.Ptr.nullPtr').  Nevertheless, the call</span><span>
</span><span id="line-77"></span><span class="hs-comment">-- to 'castStablePtrToPtr' is guaranteed not to diverge.</span><span>
</span><span id="line-78"></span><span class="hs-comment">--</span><span>
</span><span id="line-79"></span><span id="local-6989586621679508560"><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;hs_free_stable_ptr&quot;</span></span><span> </span><span id="freeStablePtr"><span class="annot"><a href="GHC.Stable.html#freeStablePtr"><span class="hs-identifier hs-var">freeStablePtr</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-type">StablePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679508560"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-82"></span><span class="hs-comment">-- Coerce a stable pointer to an address. No guarantees are made about</span><span>
</span><span id="line-83"></span><span class="hs-comment">-- the resulting value, except that the original stable pointer can be</span><span>
</span><span id="line-84"></span><span class="hs-comment">-- recovered by 'castPtrToStablePtr'.  In particular, the address may not</span><span>
</span><span id="line-85"></span><span class="hs-comment">-- refer to an accessible memory location and any attempt to pass it to</span><span>
</span><span id="line-86"></span><span class="hs-comment">-- the member functions of the class 'Foreign.Storable.Storable' leads to</span><span>
</span><span id="line-87"></span><span class="hs-comment">-- undefined behaviour.</span><span>
</span><span id="line-88"></span><span class="hs-comment">--</span><span>
</span><span id="line-89"></span><span id="local-6989586621679508583"><span class="annot"><a href="GHC.Stable.html#castStablePtrToPtr"><span class="hs-identifier hs-type">castStablePtrToPtr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-type">StablePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679508583"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-90"></span><span id="castStablePtrToPtr"><span class="annot"><span class="annottext">castStablePtrToPtr :: forall a. StablePtr a -&gt; Ptr ()
</span><a href="GHC.Stable.html#castStablePtrToPtr"><span class="hs-identifier hs-var hs-var">castStablePtrToPtr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-type">StablePtr</span></a></span><span> </span><span id="local-6989586621679508559"><span class="annot"><span class="annottext">StablePtr# a
</span><a href="#local-6989586621679508559"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Addr# -&gt; Ptr ()
forall a. Addr# -&gt; Ptr a
</span><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-var">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StablePtr# a -&gt; Addr#
forall (a :: TYPE 'AddrRep) (b :: TYPE 'AddrRep). a -&gt; b
</span><a href="Unsafe.Coerce.html#unsafeCoerceAddr"><span class="hs-identifier hs-var">unsafeCoerceAddr</span></a></span><span> </span><span class="annot"><span class="annottext">StablePtr# a
</span><a href="#local-6989586621679508559"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- The inverse of 'castStablePtrToPtr', i.e., we have the identity</span><span>
</span><span id="line-95"></span><span class="hs-comment">--</span><span>
</span><span id="line-96"></span><span class="hs-comment">-- &gt; sp == castPtrToStablePtr (castStablePtrToPtr sp)</span><span>
</span><span id="line-97"></span><span class="hs-comment">--</span><span>
</span><span id="line-98"></span><span class="hs-comment">-- for any stable pointer @sp@ on which 'freeStablePtr' has</span><span>
</span><span id="line-99"></span><span class="hs-comment">-- not been executed yet.  Moreover, 'castPtrToStablePtr' may</span><span>
</span><span id="line-100"></span><span class="hs-comment">-- only be applied to pointers that have been produced by</span><span>
</span><span id="line-101"></span><span class="hs-comment">-- 'castStablePtrToPtr'.</span><span>
</span><span id="line-102"></span><span class="hs-comment">--</span><span>
</span><span id="line-103"></span><span id="local-6989586621679508578"><span class="annot"><a href="GHC.Stable.html#castPtrToStablePtr"><span class="hs-identifier hs-type">castPtrToStablePtr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-type">StablePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679508578"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-104"></span><span id="castPtrToStablePtr"><span class="annot"><span class="annottext">castPtrToStablePtr :: forall a. Ptr () -&gt; StablePtr a
</span><a href="GHC.Stable.html#castPtrToStablePtr"><span class="hs-identifier hs-var hs-var">castPtrToStablePtr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span id="local-6989586621679508557"><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679508557"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StablePtr# a -&gt; StablePtr a
forall a. StablePtr# a -&gt; StablePtr a
</span><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-var">StablePtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Addr# -&gt; StablePtr# a
forall (a :: TYPE 'AddrRep) (b :: TYPE 'AddrRep). a -&gt; b
</span><a href="Unsafe.Coerce.html#unsafeCoerceAddr"><span class="hs-identifier hs-var">unsafeCoerceAddr</span></a></span><span> </span><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679508557"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span class="hs-comment">-- | @since 2.01</span><span>
</span><span id="line-107"></span><span id="local-6989586621679508575"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679508554"><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-type">Eq</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-type">StablePtr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679508575"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-108"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-type">StablePtr</span></a></span><span> </span><span id="local-6989586621679508552"><span class="annot"><span class="annottext">StablePtr# a
</span><a href="#local-6989586621679508552"><span class="hs-identifier hs-var">sp1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679508551"><span class="annot"><span class="annottext">== :: StablePtr a -&gt; StablePtr a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">==</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stable.html#StablePtr"><span class="hs-identifier hs-type">StablePtr</span></a></span><span> </span><span id="local-6989586621679508550"><span class="annot"><span class="annottext">StablePtr# a
</span><a href="#local-6989586621679508550"><span class="hs-identifier hs-var">sp2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-109"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">StablePtr# a -&gt; StablePtr# a -&gt; Int#
forall a. StablePtr# a -&gt; StablePtr# a -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#eqStablePtr%23"><span class="hs-identifier hs-var">eqStablePtr#</span></a></span><span> </span><span class="annot"><span class="annottext">StablePtr# a
</span><a href="#local-6989586621679508552"><span class="hs-identifier hs-var">sp1</span></a></span><span> </span><span class="annot"><span class="annottext">StablePtr# a
</span><a href="#local-6989586621679508550"><span class="hs-identifier hs-var">sp2</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-110"></span><span>           </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-number">0#</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-111"></span><span>           </span><span class="annot"><span class="annottext">Int#
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span></span><span>
</span><span id="line-112"></span></pre></body></html>